Skip to content

Conversation

@bitsandfoxes
Copy link
Contributor

@bitsandfoxes bitsandfoxes commented Nov 24, 2025

Resolves #2050

#skip-changelog

@github-actions
Copy link
Contributor

github-actions bot commented Nov 24, 2025

Messages
📖 Do not forget to update Sentry-docs with your feature once the pull request gets approved.

Generated by 🚫 dangerJS against 8a6a41c

@bitsandfoxes bitsandfoxes marked this pull request as ready for review November 26, 2025 14:50
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Core sentry functions use obsolete preprocessor directive

The csproj was changed to define SENTRY_NATIVE_PLAYSTATION instead of SENTRY_NATIVE_STATIC, but the core native functions (sentry_init, sentry_close, sentry_get_crashed_last_run, sentry_clear_crashed_last_run, sentry_reinstall_backend) still check #if SENTRY_NATIVE_STATIC. Since this symbol is never defined, these functions will always use [DllImport("sentry")] instead of [DllImport("__Internal")]. This is inconsistent with vsnprintf_sentry which correctly uses SENTRY_NATIVE_PLAYSTATION for static linking on PlayStation, and could cause the native SDK to fail to load on platforms expecting static linking.

src/Sentry.Unity.Native/SentryNativeBridge.cs#L299-L333

#if SENTRY_NATIVE_STATIC
[DllImport("__Internal")]
#else
[DllImport("sentry")]
#endif
private static extern int sentry_init(IntPtr options);
#if SENTRY_NATIVE_STATIC
[DllImport("__Internal")]
#else
[DllImport("sentry")]
#endif
private static extern int sentry_close();
#if SENTRY_NATIVE_STATIC
[DllImport("__Internal")]
#else
[DllImport("sentry")]
#endif
private static extern int sentry_get_crashed_last_run();
#if SENTRY_NATIVE_STATIC
[DllImport("__Internal")]
#else
[DllImport("sentry")]
#endif
private static extern int sentry_clear_crashed_last_run();
#if SENTRY_NATIVE_STATIC
[DllImport("__Internal")]
#else
[DllImport("sentry")]
#endif
private static extern void sentry_reinstall_backend();

src/Sentry.Unity.Native/Sentry.Unity.Native.csproj#L16-L17

OutputAssembly="$(OutDir)Sentry.Unity.Native.PlayStation.dll"
DefineConstants="$(DefineConstants);SENTRY_NATIVE_PLAYSTATION"

Fix in Cursor Fix in Web


Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: PlayStation sentry functions use dynamic instead of static linking

The old SENTRY_NATIVE_STATIC conditional compilation for sentry functions was removed, but SENTRY_NATIVE_PLAYSTATION only applies to vsnprintf_sentry. All actual sentry-native functions (sentry_init, sentry_options_new, sentry_close, etc.) now unconditionally use [DllImport("sentry")] for dynamic linking. If PlayStation requires static linking (as the old Console build did), these function calls will fail with DllNotFoundException because they're looking for a "sentry" dynamic library instead of using __Internal for statically linked symbols.

src/Sentry.Unity.Native/SentryNativeBridge.cs#L115-L117

// libsentry.so
[DllImport("sentry")]
private static extern IntPtr sentry_options_new();

src/Sentry.Unity.Native/SentryNativeBridge.cs#L297-L311

[DllImport("sentry")]
private static extern int sentry_init(IntPtr options);
[DllImport("sentry")]
private static extern int sentry_close();
[DllImport("sentry")]
private static extern int sentry_get_crashed_last_run();
[DllImport("sentry")]
private static extern int sentry_clear_crashed_last_run();
[DllImport("sentry")]
private static extern void sentry_reinstall_backend();

Fix in Cursor Fix in Web


@bitsandfoxes bitsandfoxes merged commit 96f2f65 into main Dec 5, 2025
57 checks passed
@bitsandfoxes bitsandfoxes deleted the feat/playstation-support branch December 5, 2025 07:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support for PlayStation

3 participants